﻿@using MvcPaging
@model IPagedList<Entidades.Seguridad.Permiso>


@{
    ViewBag.Title = "Index";

}
<link href="../../Content/themes/bootstrap.extra.table.css" rel="stylesheet" />
<div id="ajaxReponse">

<h1>Gestion <small>de Formularios</small></h1>

    @if (ViewBag.PermisoCrear)
    {
        <p> @Html.ActionLink("Crear Nuevo Permiso", "Create", null, new { @class = "btn" }) </p>
    }
    else
    {
        <p> <input type="submit" class="btn disabled" value="Crear Nuevo Permiso" /> </p>
    }
    
    
@{Html.RenderPartial("SearchBoxItems", "Permisos");}

<div class="pagingContainer">
    @Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)
</div>


<table class="zebra-striped">
    <thead>

        <th>
            IdPermiso
        </th>

        <th>
            Nombre
        </th>

        <th></th>
    </thead>

@foreach (var item in Model) {
    <tr>

        <td>
            @Html.DisplayFor(modelItem => item.IdPermiso)
        </td>

        <td>
            @Html.DisplayFor(modelItem => item.Nombre)
        </td>

        <td>
           
            @if (ViewBag.PermisoEditar)
            {
                @Html.ActionLink("Editar", "Edit", new { IdPermiso = item.IdPermiso }, new { @class = "btn primary" }) 
            }
            else
            {
                <input type="submit" class="btn primary disabled" value="Editar" />
            }

            @if (ViewBag.PermisoDelete)
            {
                @Html.ActionLink("Eliminar", "Delete", new { IdPermiso = item.IdPermiso }, new { @class = "btn danger" }) 
            }
            else
            {
                <input type="submit" class="btn danger disabled" value="Eliminar" />
            }

        </td>

    </tr>
}

</table>
<script>
	$(document).ready(function() {
		$("table.zebra-striped").tablesorter({ sortList: [[1,0]] });
	});
</script>


</div>
